<template>
	<view>
		<uni-grid :column="3" :square="false">
			<uni-grid-item v-for="(b,i) in brandList" :key="i">
				<view @click="showList(b)" class="brand">
					<uni-badge :maxNum="9999" absolute="rightTop" :text="b.popularity" :offset="[10,0]" type="error">
						<image :src="$base+b.logo" mode="widthFix"></image>
					</uni-badge>
					<text>{{b.bname}}</text>
				</view>
			</uni-grid-item>
		</uni-grid>
	</view>
</template>

<script>
import { productBrand } from '../../service'
	export default {
		data() {
			return {
				brandList:[],
			}
		},
		async onLoad() {
			let data = await productBrand()
			this.brandList = data
		},
		methods: {
			showList({bname,keywords}){
				uni.navigateTo({
					url:`/pages/list/list?bname=${bname}&kw=${keywords}`
				})
			}
		}
	}
</script>

<style lang="scss">
	.brand {
		display: flex;
		flex-direction: column;
		align-items: center;
		padding: $uni-spacing-col-lg 0;
		image {
			width: 200rpx;
		}
	}
</style>
